package com.qianfeng.controller;

import com.qianfeng.dto.Message;
import com.qianfeng.dto.Result;
import com.qianfeng.entity.SubjectType;
import com.qianfeng.service.SubjectTypeService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class SubjectTypeController {
    @Autowired
    private SubjectTypeService subjectTypeService;

    @RequiresAuthentication //认证通过可访问
    @CrossOrigin
    @ResponseBody
    @RequestMapping(value = "/getSubjectType")
    public Result getSubjectType() {
        Result result = new Result();
        List<SubjectType> workTypeList = subjectTypeService.getWorkTypeList();
        result.setMessage(new Message(200, "成功"));
        result.setObj(workTypeList);
        return result;
    }
}
